Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: add functional-type directive #3517

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alexarice
Copy link
Collaborator

Adds the functional-type directive, which takes two typeable directives as input.

The key difficulty here was dealing with the results, which are usually surrounded by parentheses but don't have to be if there is exactly one result.

Still a draft as this needs more tests, also stacked on #3516.

@alexarice alexarice added the core xDSL core (ir, textual format, ...) label Nov 25, 2024
@alexarice alexarice self-assigned this Nov 25, 2024
Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very very nice

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.31%. Comparing base (dcc1239) to head (83b2fa4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3517      +/-   ##
==========================================
- Coverage   90.35%   90.31%   -0.04%     
==========================================
  Files         465      465              
  Lines       58459    58524      +65     
  Branches     5581     5588       +7     
==========================================
+ Hits        52821    52858      +37     
- Misses       4207     4235      +28     
  Partials     1431     1431              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"test.functional_type %0, %1 : (i32, i32) -> ()",
"%0, %1 = test.functional_type %2, %3 : (i32, i32) -> (i32, i32)",
"%0 = test.functional_type %1 : (i32) -> i32",
"%0 = test.functional_type : () -> i32",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: There's an extra space that gets printed here, which is presumably a bug with one of the operands directives.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed by #3530

Base automatically changed from alexarice/assembly-parse-type to main November 27, 2024 10:41
@alexarice alexarice force-pushed the alexarice/functional-type-directive branch from c8bc6f7 to 940bc1a Compare November 27, 2024 11:23
@alexarice alexarice marked this pull request as ready for review November 27, 2024 11:35
@alexarice
Copy link
Collaborator Author

I've added an extra test to this. This also has given a way to actually trigger parse_single_type on the operands and results directives, which has revealed that they weren't quite implemented correctly. They now use the same assignment function as their many valued counterparts to be more robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core xDSL core (ir, textual format, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants